﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PlottingBasics.Axis;

namespace t_PlottingBasics
{
    [TestClass]
    public class t_AxisFunctorBase
    {
        class SimpleIter : AxisFunctorBase
        {
            public SimpleIter()
                : base(10)
            {
            }

            protected override Func<double> getIteratorFunc()
            {
                double r = -1.0;
                return () =>
                    {
                        r = r + 1;
                        return r;
                    };
            }
        }

        [TestMethod]
        public void TestTwoAtOnce()
        {
            SimpleIter itr = new SimpleIter();

            var i1 = itr.GetEnumerator();
            var i2 = itr.GetEnumerator();

            i1.MoveNext();
            i2.MoveNext();

            Assert.AreEqual(i1.Current, i2.Current, "The two iterators should be the same");
            i2.MoveNext();
            Assert.AreEqual(1.0, i2.Current, "i2 isn't right - should have moved ahead");
            Assert.AreEqual(0.0, i1.Current, "i1 should not have moved");
        }
    }
}